//
//  BlockButton.m
//  smartagent
//
//  Created by apple on 25/5/2018.
//  Copyright © 2018年 apple. All rights reserved.
//

#import "BlockButton.h"

@implementation BlockButton

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (id)initWithCoder:(NSCoder *)aDecoder{
    self = [super initWithCoder:aDecoder];
    if(self){
        [self addTarget:self action:@selector(clickAction:) forControlEvents:(UIControlEventTouchUpInside)];
    }
    return self;
}

- (id)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if(self){
        [self addTarget:self action:@selector(clickAction:) forControlEvents:(UIControlEventTouchUpInside)];
    }
    return self;
}

- (void)clickAction:(UIButton *)button{
    if(self.buttonClickedBlock){
        self.buttonClickedBlock(button);
    }
}

@end
